package logic.obstacles
{

    import flash.display.*;
    import flash.geom.*;

    public class ChainSaw extends GeneralObstacle
    {
    
        private var radius:Number = 20;

        private var rot:Number  =0;
        
        public function ChainSaw(configuration:Object)
        {
            radius = configuration.radius;
        } 
    
        public override function draw():void
        {
            this.graphics.beginFill(0x00000);
            this.graphics.drawCircle(0,0,radius);
            
            this.graphics.lineStyle(2,0x000000);
            for (var i:uint=0; i < 18; i++)
            {
                this.graphics.moveTo(
                    Math.sin(Math.PI * (i*20-6) / 180) *(radius ),
                    Math.cos(Math.PI * (i*20-6) / 180) *(radius ));
                    
                this.graphics.lineTo(
                    Math.sin(Math.PI * (i*20) / 180) *(radius +7),
                    Math.cos(Math.PI * (i*20) / 180) *(radius +7));
                    
                 this.graphics.lineTo( 
                    Math.sin(Math.PI * (i*20+6) / 180) *(radius ),
                    Math.cos(Math.PI * (i*20+6) / 180) *(radius ));
            }
            this.graphics.endFill();
            
            
           
        }
        
        
        public override function update():void
        {            
           rotation = (rot+=7);
           if (rot>360) {
               rot=0;
           }
        }
    
    }

}
